package com.kaibes.admin.account;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.kaibes.web.admin.AdminMenu;
import com.kaibes.web.admin.AdminMenuRes;
import com.kaibes.web.encryption.EncryptionUtils;
import com.kaibes.web.thymeleaf.ThymeleafConfig;
import com.kaibes.web.util.WebUtils;

@Configuration
public class AccountMenuInit implements InitializingBean {
    
    @Autowired
    private ThymeleafConfig thymeleafConfig;
    @Autowired
    private EncryptionUtils encryptionUtils;

    @Bean
    public AdminMenu accountManageMenu() {
        AdminMenu menu = new AdminMenu();
        menu.setKey("account-manage");
        menu.setName("账号管理");
        menu.setIcon("fas fa-portrait");
        menu.setHref("/admin/account");
        menu.setSort(1);
        menu.setParentKey(AdminMenuRes.MENU_USER);
        return menu;
    }
    
	@Override
	public void afterPropertiesSet() throws Exception {
		thymeleafConfig.putStaticVariable("WebUtils", WebUtils.class);
        thymeleafConfig.putStaticVariable("encryptionUtils", encryptionUtils);
	}
    
}


